#include "test.h"

void putcat(S *h)
{
    printf("请依次输入id,年纪,成绩,性别,姓名\n");
    scanf("%d %d %d %s %s", &h->id, &h->age, &h->sco, h->sex, h->name);
}
void _prt(S *h, char j)
{
    for (int i = 0; i < j; i++)
    {
        printf("id = %d\t", h[i].id);
        printf("年纪 = %d\t", h[i].age);
        printf("成绩 = %d\t", h[i].sco);
        printf("性别 = %s\t", h[i].sex);
        printf("姓名 = %s\n", h[i].name);
    }
}
void del(S *h, int j)
{
    h[j].id = 0;
    h[j].age = 0;
    h[j].sco = 0;
    strcpy(h[j].sex, "0");
    strcpy(h[j].name, "0");
}
void dese(S *h)
{
    printf("id = %d\t", h[5].id);
    printf("年纪 = %d\t", h[5].age);
    printf("成绩 = %d\t", h[5].sco);
    printf("性别 = %s\t", h[5].sex);
    printf("姓名 = %s\n", h[5].name);
    h[5].id = 0;
    h[5].age = 0;
    h[5].sco = 0;
    strcpy(h[5].sex, "0");
    strcpy(h[5].name, "0");
}
void per(S *h,int j)
{
    int k = 0;
    char name[128] = "";
    printf("请输入要查找的人；\n");
    scanf("%s",name);
    printf("将成绩改为多少；\n");
    scanf("%d",&k);
    for (int i = 0; i < j; i++)
    {
        if (!strcmp(h[i].name,name))
        {
            h[i].sco = k;
            return;
        }
        
    }
    printf("没找到");
}
void ps(S *h,int j)
{
    char name[128] = "";
    printf("请输入要查找的人；\n");
    scanf("%s",name);
    for (int i = 0; i < j; i++)
    {
        if (!strcmp(h[i].name,name))
        {
            printf("%d\n",h[i].sco);
            return;
        }
    }
    printf("未找到");
}